﻿/*
 * 文件名称：
 * 程序员：wangyun
 * 创建时间：2008/05/27
 * 
 * 功能说明：复杂功能模块管理页面
 * 
 * 修改人员：
 * 
 * 修改日期：
 * 
 * 修改记录：
 */

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Whir_System_Module_Contents_ModelGroupManage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        RoleHelper.IsLogin();    //登录判断

        if (!IsPostBack)
            BindData();
    }

    private void BindData()
    {
        DataSet ds = Whir.SQLServerDAL.DbHelperSQL.GetList("Whir_ModelForms", "FormsID", "*", AspNetPager1.PageSize, AspNetPager1.CurrentPageIndex - 1, "", "", "");
        int count = int.Parse(ds.Tables[1].Rows[0][0].ToString());
        AspNetPager1.RecordCount = count;
        if (count > 0)
        {
            GridView1.DataSource = ds;
            GridView1.DataBind();
        }
    }

    protected string GetModelFormNames(object modelFormIDs)
    {
        string[] temp = modelFormIDs.ToString().Split(',');
        string str = "";

        Whir.BLL.Whir_ModelForm bll = new Whir.BLL.Whir_ModelForm();
        for (int i = 0; i < temp.Length; i++)
        {
            str += bll.GetModel(int.Parse(temp[i].Split('|')[1])).formName + ",";
        }

        str = str.TrimEnd(',');
        return str;
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Redirect("ModelGroup.aspx?Action=Add");
    }

    protected void btnCancel_Click(object sender, EventArgs e)
    {
        Response.Redirect("ModelManage.aspx");
    }

    protected void AspNetPager1_PageChanged(object sender, EventArgs e)
    {
        BindData();
    }
}
